#include "stdafx.h"
#include "Locker.hpp"
#include <windows.h>


HpsFramework::Threading::Locker::Locker( void )
{
	InitializeCriticalSection(&this->_section);
}

HpsFramework::Threading::Locker::Locker( unsigned int spins )
{
	InitializeCriticalSectionAndSpinCount(&this->_section, spins);
	//SetCriticalSectionSpinCount (&this->_section, spins);
	//InitializeCriticalSectionAndSpinCount(&this->_section, spins);
}

HpsFramework::Threading::Locker::~Locker( void )
{
	DeleteCriticalSection(&this->_section);
}

void HpsFramework::Threading::Locker::lock()
{
	EnterCriticalSection(&this->_section);
}

void HpsFramework::Threading::Locker::unlock()
{
	LeaveCriticalSection(&this->_section);
}
